if (window.Worker) {

  // 创建一个专用工作线程
  const myWorker = new Worker('/javascripts/webapi/WebWorkerApi/worker.js');

  // 输入事件监控
  first.addEventListener('input', () => {
    myWorker.postMessage([first.value, second.value]);
    console.log('first Input');
  });

  second.addEventListener('input', () => {
    myWorker.postMessage([first.value, second.value]);
    console.log('second Input');
  })

  // 监听 worker 回调
  myWorker.onmessage = (e) => {
    console.log(e.data);
  }

} else {
  throw new Error('不支持Worker');
}